import api from './api';

export const stepService = {
    // 获取任务的步骤列表
    getStepsByTask: (taskId) => {
        return api.get(`/api/steps/task/${taskId}`);
    },

    // 创建步骤
    createStep: (taskId, stepData) => {
        //console.log("路由", taskId, stepData);
        return api.post(`/api/steps/task/${taskId}`, stepData);
    },

    // 更新步骤
    updateStep: (id, stepData) => {
        return api.put(`/api/steps/${id}`, stepData);
    },

    // 删除步骤
    deleteStep: (id) => {
        return api.delete(`/api/steps/${id}`);
    },

    // 更新步骤状态
    updateStepStatus: (id, isCompleted) => {
        return api.put(`/api/steps/${id}/status`, { isCompleted });
    }
};
